package com.qf.taobei.controller;

import com.qf.taobei.entity.po.Product;
import com.qf.taobei.entity.vo.RespBean;
import com.qf.taobei.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/product")

public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping("/queryAllProduct")
    public RespBean getAllProduct() {
        RespBean respBean = productService.queryAllProduct();
        return respBean;
    }
    @PostMapping("/delProductById")
    public RespBean delProductById(Long id){
        RespBean respBean = productService.delProductById(id);
        return respBean;
    }
    @PostMapping("/updateProductById")
    public RespBean updateProductById(Product product){
        RespBean respBean = productService.updateProductById(product);
        return respBean;
    }
    @PutMapping("/addProduct")
    public RespBean addProduct(Product product){
        RespBean respBean = productService.addProduct(product);
        return respBean;
    }
}
